home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C & C++ Multimedia Cyber Classroom
/
C and C++ Multimedia Cyber Classroom (Prentice Hall) (1998).iso
/
src
/
fig05_17.jar
/
Ch05
/
Fig05_17
/
Fig05_17.cpp
next >
Wrap
C/C++ Source or Header
|
1997-10-14
|
1KB
|
44 lines
// Fig. 5.17: fig05_17.cpp
// Demonstrating the sizeof operator
#include <iostream.h>
#include <iomanip.h>
int main()
{
char c;
short s;
int i;
long l;
float f;
double d;
long double ld;
int array[ 20 ], *ptr = array;
cout << "sizeof c = " << sizeof c
<< "\tsizeof(char) = " << sizeof( char )
<< "\nsizeof s = " << sizeof s
<< "\tsizeof(short) = " << sizeof( short )
<< "\nsizeof i = " << sizeof i
<< "\tsizeof(int) = " << sizeof( int )
<< "\nsizeof l = " << sizeof l
<< "\tsizeof(long) = " << sizeof( long )
<< "\nsizeof f = " << sizeof f
<< "\tsizeof(float) = " << sizeof( float )
<< "\nsizeof d = " << sizeof d
<< "\tsizeof(double) = " << sizeof( double )
<< "\nsizeof ld = " << sizeof ld
<< "\tsizeof(long double) = " << sizeof( long double )
<< "\nsizeof array = " << sizeof array
<< "\nsizeof ptr = " << sizeof ptr
<< endl;
void * ptr1;
int * ptr2;
ptr1 = ptr2;
ptr2 = ptr1;
return 0;
}